@extends('layouts.app')

@section('content')
    <div class="row">
        <div class="offset-md-2 col-md-8">
            <div class="card">
                <div class="card-header">
                    <h4><i class="fa fa-edit text-success pt-3"></i> 编辑个人资料</h4>
                </div>
                <div class="card-body">
                    <form action="{{route('users.update',$user->id)}}" enctype="multipart/form-data"
                          method="POST" accept-charset="UTF-8">
                        @csrf
                        {{method_field('PUT')}}
                        @include('shared._error')
                        <div class="mt-3">
                            <label for="name_field">用户名:</label>
                            <input type="text" class="form-control" id="name_field" name="name" value="{{old('name',$user->name)}}"/>
                        </div>
                        <div class="mt-3">
                            <label for="email_field">邮箱:</label>
                            <input type="email" class="form-control" id="email_field" name="email" value="{{old('email',$user->email)}}"/>
                        </div>
                        <div class="mt-3">
                            <label for="introduction_field">个人简介:</label>
                            <textarea name="introduction" id="introduction_field" class="form-control">{{old('introduction',$user->introduction)}}</textarea>
                        </div>
                        <div class="mt-3">
                            <label for="avatar">头像:</label>
                            <input type="file" name="avatar" class="form-control"/>
                        </div>
                        @if($user->avatar)
                            <img src="{{$user->avatar}}" class="img-thumbnail mt-3" width="200"/>
                        @endif
                        <div class="mt-3">
                           <button class="btn btn-sm btn-primary"><i class="fa fa-pen"></i>&nbsp;确认修改</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
@stop
